package com.briup.recognition.service.impl;

import com.briup.recognition.bean.BasePrivilege;
import com.briup.recognition.bean.BasePrivilegeExample;
import com.briup.recognition.dao.BasePrivilegeMapper;
import com.briup.recognition.service.BasePrivilegeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: 冯琼华
 * @Date: 2021/03/28/17:30
 * @Description:
 */
@Service
public class BasePrivilegeServiceImpl implements BasePrivilegeService {
       @Resource
        private BasePrivilegeMapper basePrivilegeMapper;

       @Override
        public List<BasePrivilege> query() {
           BasePrivilegeExample example = new BasePrivilegeExample();
           return basePrivilegeMapper.selectByExample(example);
       }

    @Override
    public void saveOrUpdate(BasePrivilege basePrivilege) {
        if (basePrivilege.getId() != null){
            basePrivilegeMapper.updateByPrimaryKey(basePrivilege);
        }else {
            basePrivilegeMapper.insert(basePrivilege);
        }
    }

    @Override
    public void deleteBPSid(long id) {
        basePrivilegeMapper.deleteByPrimaryKey(id);
    }

}
